//
//  NewArticlesItem.swift
//  weile
//
//  Created by LKM on 16/11/3.
//  Copyright © 2016年 LKM. All rights reserved.
//

import UIKit
import Kingfisher
class NewArticlesItem:UITableViewCell{
    
    @IBOutlet weak var img_head: UIImageView!
    var mArticlesItemTo:ArticlesItemTo! {
        
        didSet{
            img_head.contentMode=UIViewContentMode.scaleAspectFit
            img_head.kf.setImage(with: URL(string: Api.getImageUrl(mArticlesItemTo.ImgUrl ?? "" ) ), placeholder: Image(named: "PlaceHolderImage_small"), options: nil, progressBlock: nil) { (image, error, cacheType, imageURL) in
                if error == nil {
                    self.img_head.contentMode=UIViewContentMode.scaleAspectFill
                }
            }
            
            
            
        }
    }
    
    static func  getHeigth() ->CGFloat {
    
        /// 屏幕的宽
        let SCREENW = UIScreen.main.bounds.size.width
        
        let imageW=SCREENW-8-8;
        let imageH=imageW/2.3
        
        let cellH=imageH+8;
        
        return cellH;
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
        //设置cell透明
        backgroundColor = UIColor.clear;
        
        img_head.layer.cornerRadius=2;
        //img_head.layer.borderColor = R.colors.base_color.cgColor
        //img_head.layer.borderWidth = 1
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
}
